package com.yaorange.web.controller.certificate;

import com.yaorange.certificate.domain.NjtYtjPos;
import com.yaorange.certificate.service.NjtYtjPosService;
import com.yaorange.common.core.controller.BaseController;
import com.yaorange.common.core.domain.AjaxResult;
import com.yaorange.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author coach tam
 * @email 327395128@qq.com
 * @values 坚持灵活 灵活坚持
 * @since 2025/1/10
 */
@RestController
@RequestMapping("/certificate/pos")
public class NjtYtjPosController extends BaseController {

    @Autowired
    private NjtYtjPosService njtYtjPosService;
    @GetMapping("/list")
    @PreAuthorize("@ss.hasPermi('certificate:pos:list')")
    public TableDataInfo list(NjtYtjPos njtYtjPos) {
        startPage();
        List<NjtYtjPos> list = njtYtjPosService.list(njtYtjPos);
        return getDataTable(list);
    }

    @PostMapping
    @PreAuthorize("@ss.hasPermi('certificate:pos:add')")
    public AjaxResult add(@RequestBody NjtYtjPos njtYtjPos){
        njtYtjPosService.add(njtYtjPos);
        return success();
    }

    @DeleteMapping("/{ids}")
    @PreAuthorize("@ss.hasPermi('certificate:pos:delete')")
    public AjaxResult delete(@PathVariable("ids")Long[] ids) {
        njtYtjPosService.deleteByIds(ids);
        return success();
    }
}
